其他
钉钉邀请上台功能分析
本文为看雪论坛优秀文章
看雪论坛作者ID:凌哥
一、分析邀请call
1、首先分析钉钉的一键邀请是如何发送到服务器的。
2、首先x32dbg附加tblive.exe进程对所有发包函数进行下断,sendto,send,WSASend,WSASendTo。
3、经过反复测试,点击邀请按钮没有任何一个函数被断下。
4、而我们也知道tblive进程是由DingTalk主进程创建出来的,那么他们可能存在管道通讯由主进程进行发包。
5、所以附加DingTalk进程,并重复上述操作,在WSASend函数断了下来。
二、分析创建成员指针
三、源代码
#include "pch.h"
#include <Windows.h>
#pragma comment(linker,"/EXPORT:?air_roi_create@@YAHPAPAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z=air2Org.?air_roi_create@@YAHPAPAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z")
#pragma comment(linker,"/EXPORT:?air_roi_destroy@@YAHPAX@Z=air2Org.?air_roi_destroy@@YAHPAX@Z")
#pragma comment(linker,"/EXPORT:?air_roi_detect@@YAHPAXPBEHHHW4air_pixel_format@@PAEHH@Z=air2Org.?air_roi_detect@@YAHPAXPBEHHHW4air_pixel_format@@PAEHH@Z")
#pragma comment(linker,"/EXPORT:air_dl_segment_create=air2Org.air_dl_segment_create")
#pragma comment(linker,"/EXPORT:air_dl_segment_destroy=air2Org.air_dl_segment_destroy")
#pragma comment(linker,"/EXPORT:air_dl_segment_detect=air2Org.air_dl_segment_detect")
#pragma comment(linker,"/EXPORT:air_dl_segment_get_insize=air2Org.air_dl_segment_get_insize")
// 创建成员指针偏移
const DWORD g_dwCreateMemberOffset = 0x1E1523;
const DWORD g_dwOrginCallOffset = 0x36BB;
// 邀请call偏移
const DWORD g_dwInviteCallOffset = 0x1974c0;
#define HOOK_LEN 5
VOID SetHook(DWORD_PTR dwHookAddr, LPVOID dwPfnAddr, BYTE* btBackCode)
{
// 准备HOOK
BYTE btJmp[HOOK_LEN] = { 0xE9 ,0,0,0,0 };
*(DWORD*)&btJmp[1] = (DWORD)dwPfnAddr - dwHookAddr - HOOK_LEN;
// 获取自身进程句柄
HANDLE hProcess = GetCurrentProcess();
// 备份数据
if (!ReadProcessMemory(hProcess, (LPVOID)dwHookAddr, btBackCode, HOOK_LEN, NULL))
{
MessageBox(NULL, "HOOK失败", NULL, NULL);
return;
}
// 开始hook
if (!WriteProcessMemory(hProcess, (LPVOID)dwHookAddr, btJmp, HOOK_LEN, NULL))
{
MessageBox(NULL, "HOOK失败", NULL, NULL);
return;
}
}
VOID UnSetHook(DWORD_PTR dwHookAddr, BYTE* btBackCode)
{
// 获取自身进程句柄
HANDLE hProcess = GetCurrentProcess();
// 卸载hook
if (!WriteProcessMemory(hProcess, (LPVOID)dwHookAddr, btBackCode, HOOK_LEN, NULL))
{
MessageBox(NULL, "卸载HOOK失败", NULL, NULL);
return;
}
}
// 邀请原数据
DWORD g_dwCreateMemberOrgCallAddr = NULL;
DWORD g_dwCreateMemberAddr = NULL;
BYTE g_btCreateMemberCode[5]{};
DWORD g_dwCreateMemberCallback = NULL;
DWORD g_dwInvateCallAddr = NULL;
DWORD g_dwMemberPoint = NULL;
void AutoInviteMember()
{
__asm
{
mov ecx, g_dwMemberPoint
call g_dwInvateCallAddr
}
return;
}
_declspec(naked) void HookCreateMemberFunc()
{
__asm
{
pushad
pushf
mov eax, dword ptr ss:[ebp - 0x48]
mov [g_dwMemberPoint], eax
}
AutoInviteMember();
__asm
{
popf
popad
call g_dwCreateMemberOrgCallAddr
jmp g_dwCreateMemberCallback
}
}
// 入口函数
BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, PVOID pvReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
// 初始化数据
DWORD dwClassroomHandle = (DWORD)GetModuleHandle("classroom.dll");
g_dwInvateCallAddr = dwClassroomHandle + g_dwInviteCallOffset;
g_dwCreateMemberAddr = dwClassroomHandle + g_dwCreateMemberOffset;
g_dwCreateMemberCallback = g_dwCreateMemberAddr + HOOK_LEN;
g_dwCreateMemberOrgCallAddr = dwClassroomHandle + g_dwOrginCallOffset;
// HOOK加入成员生成指针部分
SetHook(g_dwCreateMemberAddr, HookCreateMemberFunc, g_btCreateMemberCode);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
UnSetHook(g_dwCreateMemberAddr, g_btCreateMemberCode);
}
return TRUE;
}
看雪ID:凌哥
https://bbs.pediy.com/user-home-870110.htm
# 往期推荐
1.Android APP漏洞之战——Activity漏洞挖掘详解
5.DAP-LINK研究笔记-用STM32单片机替换J-LINK
球分享
球点赞
球在看
点击“阅读原文”,了解更多!